package com.findyou.controller;

import com.findyou.pojo.User;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Title: UserController
 * @Author 贾金博
 * @Package com.findyou.controller
 * @Date 2024/3/3 21:35
 * @description:
 */
@RestController
@RequestMapping("user")
public class UserController {

    //分页查询的方法

    @GetMapping // 接收到param传参 也可以不传参数 默认是 1 和 10
    public List<User> page(@RequestParam(required = false, defaultValue = "1") int page, @RequestParam(required = false, defaultValue = "10") int size) {
        return null;
    }

    //接收的是json类型的
    @PostMapping
    public User add(@RequestBody User user) {
        return user;
    }

    //路径参数 动态的值
    @GetMapping("{id}")
    public User getUser(@PathVariable int id) {
        return null;
    }

    @PutMapping
    public User update(@RequestBody User user) { // 接收的是json参数
        return null;
    }

    //用户删除
    @DeleteMapping("{id}")
    public User delete(@PathVariable String id) {
        return null;
    }

    // 条件模糊
    @GetMapping("search")
    public List<User>search(String keywork,@RequestParam(defaultValue = "1", required = false) int page,
                                           @RequestParam(defaultValue = "1", required = false) int size) {
        return null;
    }
}
